<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>填写预约信息</title>
    <%@ include file="/main/main_css.jsp" %>
    <%@ include file="/main/main_js.jsp" %>
    <script src="JS/main.js"></script>
</head>
<body>
    <!--  -->
    <div class="all-wrapper">
        <div class="row com-header">
            <span>智能服务自助终端</span>
        </div>
        <div class="row main-content table-details">
        	<div class="row" >
                <div class="time-count pull-right">
                   <span>剩余</span> <span id="time" class="text-red"></span> <span>秒</span>
                </div>
            </div>
            <div class="row">
                <div class="col-md-24">
                    <h1>网上预约</h1>
                </div>
                <form class="form-horizontal" id="saveAppointmentInfoForm" action="saveAppointmentInfo">
                    <div class="row">
                        <div class="col-md-12">
                            <div class="form-group form-group-lg">
                                <label class="control-label col-md-7">预约人姓名：</label>
                                <div class="col-md-15">
                                    <input type="text" id="userName" name="userName" value="${user.getRealName() }" class="form-control input-lg">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="form-group form-group-lg">
                                <label class="control-label col-md-7">预约人电话：</label>
                                <div class="col-md-15">
                                    <input type="text" id="phone" onclick="imeOpen()" name="userPhone" value="${user.getPhone() }" class="form-control input-lg">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="form-group form-group-lg">
                                <label class="control-label col-md-7">身份证号码：</label>
                                <div class="col-md-15">
                                    <input type="text" id="idcard" name="idcard" value="${user.getIdCard() }" class="form-control input-lg">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="form-group form-group-lg">
                                <label class="control-label col-md-7">预约时间：</label>
                                <div class="col-md-15">
                                    <input type="text" id="time" readonly="readonly"  name="time" value="${usertime }" class="form-control input-lg">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="form-group form-group-lg">
                                <label class="control-label col-md-7">预约事项：</label>
                                <div class="col-md-15">
                                    <input type="hidden" name="itemId" value="${useritemId }" class="form-control input-lg">
                                    <input type="text" readonly="readonly"  id="itemName" value="${itemName }" class="form-control input-lg">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="form-group form-group-lg">
                                <label class="control-label col-md-7">办理部门：</label>
                                <div class="col-md-15">
                                    <input type="hidden" name="siteid" value="${userdeptId }" class="form-control input-lg">
                                    <input type="text" id="deptName" readonly="readonly" value="${deptName }" class="form-control input-lg">
                                </div>
                            </div>
                        </div>
                    </div>
            </div>
        </div>
        <div class="row footer">
            <a class="btn btn-success btn-lg" href="loginOut" role="button"><i class="fa fa-reply"></i>返回首页</a>
            <a class="btn btn-primary btn-lg" onclick="onSubmit()" href="javascript:void(0);" role="button">提交<i class="fa fa-hand-pointer-o"></i></a>
        </div>
      </form>
    </div>
    <form id="loginOut" action="loginOut"></form>
    <!--  -->
    <script src="static/plugins/html5shiv.min.js" id="html5shiv"></script>
    <script src="static/plugins/respond.min.js" id="respond"></script>
    <script src="static/plugins/jquery.min.js" type="text/javascript"></script>
    <script src="static/plugins/bootstrap/bootstrap.min.js" type="text/javascript"></script>
    <script src="static/plugins/bootstrap/bootstrapValidator.js" type="text/javascript"></script> 
    <script src="static/js/common.js" type="text/javascript"></script>
	 <script type="text/javascript">
		//加入倒计时
		var count =  119;
		function countdown(){
			$("#time").text(count);
			if(count > 0){
				window.setTimeout("countdown()",1000);
				count --;
			}else{
				$("#loginOut").submit();
			}
		}
		countdown();
		
	 	function onSubmit(){
	 		 var index = layer.load(3, {
	 	           shade: [0.3,'#000'] //0.1透明度的白色背景  
	 	       });
	 	       setTimeout(function(){
	 	           layer.close(index);
	 	       },1000);
			  $("#saveAppointmentInfoForm").submit();
	 	}
	 	//绑定部门
    	$("#deptName").click(function (){
    		var info = $("#deptName").val();
    	    var test = { 'info': info, 'ispassword': 0 };
    	    var data = JSON.stringify(test);
    	    send_command(
    	        "imewrite", data,
    	        function (receivedData) {
    	            var data = JSON.parse(receivedData);
    	            $("#deptName").val(data.msg);
    	        }
    	    );
    	});
		//绑定事项
    	$("#itemName").click(function (){
    		var info = $("#itemName").val();
    	    var test = { 'info': info, 'ispassword': 0 };
    	    var data = JSON.stringify(test);
    	    send_command(
    	        "imewrite", data,
    	        function (receivedData) {
    	            var data = JSON.parse(receivedData);
    	            $("#itemName").val(data.msg);
    	        }
    	    );
    	});
	  	//绑定时间
	  	$("#time").click(function (){
    		var info = $("#time").val();
    	    var test = { 'info': info, 'ispassword': 0 };
    	    var data = JSON.stringify(test);
    	    send_command(
    	        "imewrite", data,
    	        function (receivedData) {
    	            var data = JSON.parse(receivedData);
    	            $("#time").val(data.msg);
    	        }
    	    );
    	});
	  	//绑定身份证号码
	  	$("#idcard").click(function (){
    		var info = $("#idcard").val();
    	    var test = { 'info': info, 'ispassword': 0 };
    	    var data = JSON.stringify(test);
    	    send_command(
    	        "imewrite", data,
    	        function (receivedData) {
    	            var data = JSON.parse(receivedData);
    	            $("#idcard").val(data.msg);
    	        }
    	    );
    	});
	  	//绑定手机号
	  	$("#phone").click(function (){
    		var info = $("#phone").val();
    	    var test = { 'info': info, 'ispassword': 0 };
    	    var data = JSON.stringify(test);
    	    send_command(
    	        "imewrite", data,
    	        function (receivedData) {
    	            var data = JSON.parse(receivedData);
    	            $("#phone").val(data.msg);
    	        }
    	    );
    	});
	  	//手机号校验
		function checkPhone(phone){
			var reg = /^1[3|4|5|8][0-9]\d{4,8}$/;
			if(reg.test(phone)){
				return true;
			}else{
				return false;
			}
		}
	  	//绑定用户名
    	$("#userName").click(function (){
    		var info = $("#userName").val();
    	    var test = { 'info': info, 'ispassword': 0 };
    	    var data = JSON.stringify(test);
    	    send_command(
    	        "imewrite", data,
    	        function (receivedData) {
    	            var data = JSON.parse(receivedData);
    	            $("#userName").val(data.msg);
    	        }
    	    );
    	});
    	//
    	
		
    	//
    </script>
</body>
<!-- 添加动画 -->
<script type="text/javascript">

	var index = layer.load(3, {
	    shade: [0.3,'#000'] //0.1透明度的白色背景  
	});
	setTimeout(function(){
	    layer.close(index);
	},500);


</script>
</html>